import React, {Component} from 'react';
import { Badge,Card,NoticeBar, Button,Scroller,Popup,Group, Field, Toast,NumberPicker, Context,SelectField, TextField   } from 'saltui';
import Icon from 'salt-icon';
import EditIcon from '../EditIcon';
import $ from 'jquery';

// TableEdit< onChange type>
export default class TableEdit extends React.Component {

  constructor(props) {
    super(props);
  }

  render(){

    let Form =  require("../../../common/form/sub/"+this.props.type);
    let data =  $.extend(true,this.props.data,{buttonName:"新增", options:this.props.options, onChange:this.props.onChange,typeid:this.props.typeid,option:this.props.option});
    let TypeObj = React.createElement(Form, data)


    return  <div> <EditIcon typeObj={TypeObj} onChange = {this.props.onChange}  type={this.props.type} /> <Icon name="cross" width="20" height="20" onClick={(e) => this.props.del(this.props.id,e)}/></div>
  }

}
